<?php

require "include/bittorrent.php";
dbconn();
loggedinorreturn();

if (get_user_class() < UC_MODERATOR)
	stderr("错误", "权限不足");
$status = $_GET['status'];
if ($status)
	int_check($status, true);

$res = sql_query("SELECT * FROM users WHERE status='pending' ORDER BY username") or sqlerr();
if (mysql_num_rows($res) != 0) {
	stdhead("未验证用户列表");
	begin_main_frame();
	begin_frame("");
	print'<br><table width=100% border=1 cellspacing=0 cellpadding=5>';
	if ($status)
		print '<tr><td class=rowhead colspan=5><font color=red size=1>帐号状态已经更新</font></tr></td>';
	print'<tr>';
	print'<td class=rowhead><center>帐号</center></td>';
	print'<td class=rowhead><center>邮箱</center></td>';
	print'<td class=rowhead><center>注册时间</center></td>';
	print'<td class=rowhead><center>设置状态</center></td>';
	print'<td class=rowhead><center>手动确认</center></td>';
	print'</tr>';
	while ($row = mysql_fetch_assoc($res)) {
		$id = $row['id'];
		print'<tr><form method=post action=modtask.php>';
		print'<input type=hidden name=\'action\' value=\'confirmuser\'>';
		print("<input type=hidden name='userid' value='$id'>");
		print'<td align=center>' . get_username($id) . '</td></a>';
		print'<td align=center>' . $row['email'] . '</td>';
		print'<td align=center>' . $row['added'] . '</td>';
		print'<td align=center><select name=confirm><option value=pending>未验证</option><option value=confirmed>已验证</option></select></td>';
		print'<td align=center><input type=submit value="提交">';
		print'</form></tr>';
	}
	print '</table>';
	end_frame();
	end_main_frame();
} else {
	if ($status) {
		stderr("成功", "帐号状态已经更新");
	} else {
		stderr("Word天！", "没有未验证用户");
	}
}
stdfoot();
